#include "Info.h"

/* Escribe los valores correspondientes por pantalla */
void showFields(int wordMode, int lineMode, int byteMode, int words,
		int lines, int bytes) {
	int fieldsToShow = wordMode+lineMode+byteMode;
	int i;
	for(i=0; i<fieldsToShow; i++) {
		if(fieldsToShow > 1) {
			printf(" ");
		}
		if (lineMode == 1) {
			printf("%d", lines);
			lineMode = 0;
		}
		else if (wordMode == 1) {
			printf("%d", words);
			wordMode = 0;
		}
		else if (byteMode == 1)
			printf("%d", bytes);
	}
}

void info(int wordMode, int lineMode, int byteMode) {
	showFields(wordMode, lineMode, byteMode, words, lines, characters);
}

void infoParam(int wordMode, int lineMode, int byteMode, char* inputFileName) {
	info(wordMode, lineMode, byteMode);
	printf(" %s \n", inputFileName);
}

void infoAcum(int wordMode, int lineMode, int byteMode, int acumWords,
		int acumLines, int acumBytes) {
	/*Salida archivos acumulados*/
	showFields(wordMode, lineMode, byteMode, acumWords, acumLines, acumBytes);
	printf(" total \n");
}

